GBML manual / Strings

string

n written out as text, for building a line of text around a number - converting a number to text. string(5) is "5".

Syntax

string(n) -> string

Arguments

NameType
nreal

Returns

string

Description

n written out as text, for building a line of text around a number - converting a number to text. string(5) is the text 5.

For a number embedded directly in a message, $"score: {score}" template-string interpolation already does this for you. Reach for string instead when you need the number's text ON ITS OWN - to pass into string_join/string_replace, to compare, or to store.

Example

var score = 1200;
var score_text = string(score);
var line = string_join("FINAL SCORE ", score_text);

Uses the exact same conversion $"...{n}..." already does internally for a number, in a fixed 16-character buffer - large enough for any ordinary score/coordinate/timer; an extreme value can still be cut, the same as everywhere else in this group.

On the GBA

Uses the exact same conversion $"...{n}..." template-string interpolation already does internally for a number, in a fixed 16-character buffer - large enough for any ordinary score/coordinate/timer; an extreme value can still be cut, the same as everywhere else in this file.

See also: string_to_numberstring_joinstring_from_number